package text111;

import java.awt.List;
import java.util.Arrays;
import java.util.LinkedList;

public class Solution33 {
	int res,k;
    public int kthLargest(TreeNode root, int k) {
    	this.k = k;
		dfs(root);
		return res;
    }
    
    void dfs(TreeNode root) {
        if(root == null) return;
        dfs(root.right);
        if(k == 0) return;
        if(--k == 0) res = root.val;
        dfs(root.left);
      
    }
}
